// Author:

$(function() {

	// The dom is primed and ready to go.


	ScreenWidth();






	//*// Analytics Tracking Start //*//
	// track outbound links
	$("a[href^='http://'], a[href^='https://']").click(function(){	
		_gaq.push(['_trackEvent', "Outbound Link", this.href]);
	});
	// track PDF files
	$("a[href$='.pdf']").click(function(){
		_gaq.push(['_trackEvent', 'PDF Download', this.href]);
	});
 	//*// Analytics Tracking End //*//  
});




// Listen for orientation changes
/*
During these changes, the window.orientation property may change. 
A value of 0 means portrait view, -90 means a the device is landscape rotated to the right, 
and 90 means the device is landscape rotated to the left.
*/
window.addEventListener("orientationchange", function() {
	// Announce the new orientation number
	var OV = window.orientation
	if ( OV == -90 ){
		//alert("Right Landscape");
		ScreenWidth();
	}
	else if ( OV == 0 )
	{
		//alert("Portait");
		ScreenWidth();
	}
	else if ( OV == 90)
	{
		//alert("Left Landscape");
		ScreenWidth();
	}
	
}, false);

function ScreenWidth(){
	// detect and display screen width
	$("#header").empty();
	var sWidth = $(window).width();
	var headerWidth = $("#header").width();
	$("#header").append("<p>Screen Width " + sWidth + "px</p>");
	$("#header").append("<p>Element Width " + headerWidth + "px</p>");	
}